# -*- coding: UTF-8 -*- #
"""
-------真正的勇士， 敢于直面惨淡的Warning、 敢于正视淋漓的Error-----
@author : 贾鹏博
@file : util_token.py
@time : 2022/5/12 9:52
"""

import os
import yaml
from Autoapi_frame.interface.获取token import *

def write_yaml(token):
    # 获取根目录路径
    cur = os.path.dirname(os.path.dirname(__file__))
    yaml_path = os.path.join(cur, '../test_data/token.yaml')
    print(yaml_path)

    # 获取 token 内容
    t = {'token': token}
    with open(yaml_path,'w',encoding='utf-8') as f:
        yaml.dump(t,stream=f,allow_unicode=True)



def get_yaml():
    yaml_file = '../test_data/token.yaml'
    with open(yaml_file,'r',encoding='utf-8') as f:
        data = yaml.safe_load(f)
        print(data)
    return data







